// pages/user/userinfo/userinfo.js
var httpUtil = require('../../../utils/httpUtil.js')
var uiUtil = require('../../../utils/uiUtil.js')
var util = require('../../../utils/util.js')
var emptyUtil = require('../../templates/empty/empty.js')
var that
Page({

  /**
   * 页面的初始数据
   */
  data: {
    userInfo: null,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    that = this
    this.requestUserInfo()
  },
  onShareAppMessage: function (res) {
    return util.handleShareApp()
  },
  /**
   * 获取删除订单
   */
  requestUserInfo() {
    uiUtil.showLoading("请稍候..")
    httpUtil.PostRequest("user_detail", {}, {
      success(res) {
        console.log(res)
        that.setData({
          userInfo: res
        })
      },
      fail(code, res) {
        var text = emptyUtil.getErrText(code, res, "获取用户资料失败")
        emptyUtil.showFailView(text)
      },
      complete() {
        uiUtil.hideLoading()
      }
    })
  },

})
